-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Masthead): Update structure #730
feat(Masthead): Update structure #730
Conversation
This isn't in a merge-ready state (I'll have to make some final updates after #729 lands) but it should be ready now for some preliminary reviews. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great 🏆. One comment bellow regarding simplifying / removing the stringifyJSXElement
helper.
} | ||
|
||
/** Gets a string representation of an element including */ | ||
export function stringifyJSXElement( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good, but I think you can do just return context.getSourceCode().getText(node)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦
valid: [ | ||
{ | ||
code: `<Masthead />`, | ||
}, | ||
{ | ||
code: `import { Masthead } from '@patternfly/react-core'; <Masthead someOtherProp />`, | ||
}, | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The valid tests should probably be updated. One would be the code
from one of the invalid tests (without the import statement), and the other could be the output
from one of the invalid tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops
output: `import { Masthead, MastheadBrand, MastheadMain, MastheadToggle } from '@patternfly/react-core'; <Masthead><MastheadMain><MastheadToggle>Foo</MastheadToggle><MastheadBrand>Bar</MastheadBrand></MastheadMain></Masthead>`, | ||
errors: [ | ||
{ | ||
message: `The structure of Masthead has been updated, MastheadToggle and MastheadBrand should now be wrapped in MastheadMain.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit not a blocker: wdyt about updating the message that gets output to only mention the applicable element? Instead of saying both "toggle and brand...", on a MastheadToggle, only mention "toggle...".
}, | ||
], | ||
}, | ||
// stage one of a post-renamed file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit not a blocker: for these comments for the pre/post renamed file, maybe instead "Stage [one|two] of a file that [has been|has NOT been] fixed by masthead-name-changes rule"
Closes #718